import Vue from 'vue'
const socket = {
  state: {
    websocket: null
  },
  mutations: {
    init_WebSocket: (state, data) => {
        state.websocket = data.websock
    },
    set_webSocket_open: (state, data) => {
        state.websocket.onopen = data.handle
    },
    set_webSocket_error: (state, data) => {
        state.websocket.onerror = data.handle
    },
    set_webSocket_message: (state, data) => {
        state.websocket.onmessage = data.handle
    },
    set_webSocket_close: (state, data) => {
        state.websocket.onclose = data.handle
    },
    set_webSocket_IMSocket: (state, data) => {
      state.websocket.IMSocket = data
    }
  },
  actions: {
    // setSidebar: ({ commit }, type) => {
    //   commit('SET_SIDEBAR_TYPE', type)
    // },
  }
}

export default socket